package com.tianpengtech.admin.moneylog;

import java.util.Map;

import com.jfinal.plugin.activerecord.Model;
import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.admin.AbstractAdmin;
import com.tianpengtech.common.model.moneylog.MoneyLog;
import com.tianpengtech.common.search.EqualCondition;
import com.tianpengtech.common.search.QueryConstructor;

public class MoneyLogAdminServiceImpl extends AbstractAdmin{

	@Override
	public void beforeAdd(Model<?> model) throws ValidateException {

	}

	@Override
	public void beforeQueryById(Model<?> model, int id) {

	}

	@Override
	public void beforeUpdate(Model<?> model) throws ValidateException {

	}

	@Override
	public void beforeDelete(Model<?> model) {

	}

	@Override
	public void builderSQLExpected(Model< ? > model,
			QueryConstructor queryConstruct, Map< String, Object > params) {

		queryConstruct.and(new EqualCondition(MoneyLog.TYPE, MoneyLog.TYPE_YAOQING));
		int status = model.getInt(MoneyLog.DELETETAG);
		if(status>-1){
			queryConstruct.and(new EqualCondition(MoneyLog.DELETETAG,status));
		}
	}

	@Override
	public String tableName() {
		return MoneyLog.dao.tableName();
	}

}